<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>个人中心</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css" />
      <link rel="stylesheet" type="text/css" href="../../css/common.css" />
      <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #F3EFEE;}
          .aui-active .aui-bar-tab-label{
            color: #f5a51c
          }
          .login {height:240px;background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);/*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/position: relative;}
      	.login .personal_logo {width: 4rem;height: 4rem;border-radius: 50%;margin: 0 auto 9px;/*position: absolute; top: 60px; left: 20px;*/}
      		.login .userinfo {position: absolute; top: 60px;text-align: center; left: 0; right: 0;}
      		.login .userinfo .title {font-size: 0.8rem; color: #fff;}

      		/* 设置条目 */
      		.item {height: 3rem;line-height: 3rem;padding-left: 0.7rem;background-color: #fff;}
      		.item_ico {float: left;width: 2.3rem;padding: 0.7rem 0.7rem 0.7rem 0;}
      		.item_arrow {float: right;width: 1.5rem;padding: 1rem 0.7rem 1rem 0;}
      		.item span {font-size: 0.7rem;}
          [v-cloak] {
              display: none;
          }
          .aui_list{
              background-image: linear-gradient(0,#eee,#eee 50%,transparent 50%);
          }
          .aui-list-item{
              background-image:linear-gradient(0,#eee,#eee 50%,transparent 50%) !important;
          }
          .aui-radio:checked{
            background-color: #f23030;
            border: solid 1px #f23030;
          }
          #app {
            padding-bottom: 2.5rem!important;
          }
          .apply_footer_btn {
            position: fixed!important;
            width: 100%;
            bottom: 0;
          }
      </style>
  </head>
  <body>
<div id="app" v-cloak>

<div class="user_nav_line"></div>
  <div class="aui-refresh-content">
    <ul class="aui-list aui-media-list">
      <li class=" aui-list-item-middle apply_main_li" v-if="info.goods" v-for="items in info.goods">
      <div class="aui-media-list-item-inner">
          <div class="aui-list-item-media" style="width: 4rem;">
              <img :src="items.goods_pic" class="aui-list-img-md">
          </div>
          <div class="aui-list-item-inner">
              <div class="aui-list-item-text">
                <div  class="aui-list-item-title" style="width: 100%;padding-right: 0.2rem;">
                  <div class="aui-font-size-12">{{items.goods_name}}</div>
                  <div class="aui-list-item-text aui-font-size-12">{{items.sku_info}}<div  class="aui-list-item-right">×{{items.goods_nums}}</div></div>
               </div>
              </div>
          </div>
      </div>
   </li>
      <li><div class="user_nav_line"></div></li>
        <!-- <li class="aui-list-item aui-list-item-middle  apply_main_li">
              <div class="aui-list-item-inner aui-list-item-arrow" >
                <div class="aui-list-item-text" @click="orderClose2(info.order.order_id)">
                    <div class="aui-list-item-title aui-font-size-14">货物状态</div>
                    <div class="aui-list-item-right personGender" :id="status_id">{{status}}</div>
                </div>
            </div>
        </li> -->
        <li class="aui-list-item aui-list-item-middle  apply_main_li">
              <div class="aui-list-item-inner aui-list-item-arrow" >
                <div class="aui-list-item-text" @click="orderClose(info.order.order_id)">
                    <div class="aui-list-item-title aui-font-size-14">退货原因</div>
                    <div class="aui-list-item-right personGender" :id="reason_id">{{reason}}</div>
                </div>
            </div>
        </li>
        <!-- <li class="aui-list-item-middle  apply_main_li">
              <div class="aui-list-item-inner" >
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title aui-font-size-14">拍错了，要重选</div>
                </div>
            </div>
        </li> -->
        <li><div class="user_nav_line"></div></li>
        <li class="aui-list-item aui-list-item-middle" v-if="info.order">
              <div class="aui-media-list-item-inner">
                  <div class="aui-list-item-media" style="padding-right:0.5rem;width:3.5rem;padding-right:0">退款金额:</div>
                  <div class="aui-list-item-inner" style="color:#f23030;padding-top: 0.6rem;">￥{{info.order.total_price}}</div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle apply_why_text" v-if="info.order">
              <div class="aui-media-list-item-inner" style="color: #999;">
                最多 ￥ {{info.order.total_fee}}，含发货邮费￥{{info.order.express_fee}}
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="padding-right:0.5rem;width:3.5rem;padding-right:0">备注:</div>
                <input type="text" placeholder="选填" v-model="content" style="padding-top: 0.1rem;">
            </div>
        </li>
        <!-- <li><div class="user_nav_line"></div></li>
        <li class="aui-list-item aui-list-item-middle" style="line-height: 2.2rem;">
              <div class="aui-media-list-item-inner">
                上传凭证
            </div>
        </li>
        <li class="aui-list-item-middle aui-list-item">
              <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width: 4rem;">
                    <img src="../../image/my/m34.png" class="aui-list-img-md">
                </div>
              </div>
        </li> -->

    </ul>
  </div>
<div class="apply_footer_btn" @click="refundAbout()">提交</div>
</div>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/zepto.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript" src="../../script/utils.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript" src="../../script/aui-tab.js"></script>
  <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  <script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
  <script type="text/javascript" src="../../script/aui-popup.js"></script>
  <script type="text/javascript" src="../../script/aui-dialog.js"></script>
  <script type="text/javascript">

    apiready = function(){


      api.showProgress({
          title: '努力加载中...',
          text: '先喝杯茶...',
          modal: false
      });
      var app = new Vue({
          el: '#app',
          data: {
            info: {},
            reason_id: 0,
            reason: '请选择',
            content: ''
          },
          created: function() {
              var $this = this;
              $this.getOrder()
              api.addEventListener({
                  name: 'sqtk'
              }, function(ret, err) {
                console.log(JSON.stringify(ret.value))
                $this.reason_id = ret.value.id
                $this.reason = ret.value.reason
              });
          },
          mounted: function() {
              var $this = this;
              api.hideProgress();
              var pullRefresh = new auiPullToRefresh({
                  container: document.querySelector('.aui-refresh-content'),
                  triggerDistance: 100
              }, function(ret) {
                  if (ret.status == "success") {
                    $this.getOrder(function () {
                      setTimeout(function () {
                        pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                      }, 500)
                    })
                  }
              })
          },
          methods: {
            getOrder: function (fn) {
                var $this = this;
              api.ajax({
                  url: window.Url.Freeorder_getOrderDetail,
                  method: 'post',
                  data: {
                      values: {
                          token: $api.getStorage('token'),
                          orderId: api.pageParam.id,
                      }
                  }
              }, function(ret, err) {
                  if (ret) {
                      $this.info = ret.data
                      fn && fn()
                  } else {
                      api.alert({
                          msg: JSON.stringify(err)
                      });
                  }
              })
            },
            orderClose: function (o_id){
              var $_this = this
              api.openFrame({
                  name: 'pay_order',
                  url: './cancalResult.html',
                  bounces: false,
                  pageParam:{
                    o_id: o_id,
                    type: 2
                  }
              });
            },
            // orderClose2: function (o_id){
            //   var $_this = this
            //   api.openFrame({
            //       name: 'pay_order',
            //       url: './cancalResult.html',
            //       bounces: false,
            //       pageParam:{
            //         o_id: o_id,
            //         type: 2
            //       }
            //   });
            // },
            refundAbout: function (){
              var $this = this
              api.ajax({
                  url: window.Url.Freeorder_refundOrder,
                  method: 'post',
                  data: {
                      values: {
                          token: $api.getStorage('token'),
                          orderId:  api.pageParam.id,
                          reason_id: $this.reason_id,
                          type: 1,
                          content: $this.content
                      }
                  }
              }, function(ret, err) {
                  if (ret) {
                    console.log(JSON.stringify(ret))
                    if (ret.re == 1) {
                      api.openWin({
                          name: 'refoundAbout',
                          url: './headerone.html',
                          pageParam: {
                              msg:'退货详情',
                              url:'./refoundAbout.html',
                              id:api.pageParam.id
                          }
                      });
                      api.execScript({
                          name: 'orderAll',
                          script: 'window.location.reload()'
                      })
                    } else {
                      api.toast({ msg: ret.info,duration: 2000,location:'middle' });
                    }

                  } else {
                      api.alert({msg: JSON.stringify(err)});
                  }
              })
              }
          }
      })
    };


  </script>
  </html>
